﻿@using System.Activities.Statements
@using Domain.Entity
@using Microsoft.Web.Helpers
@using Pro260Website.Models
@model Domain.Entity.Review

@{
    ViewBag.Title = Model.Name;
}

<h2 class="title @Html.GetColor(Request.Cookies["color"])">@Model.Name</h2><br/>
<div id="titlelessItem">
    <div class = "item">
        <h3>By @Html.ActionLink(@Model.Account.Username, "ViewAccount", "Account", new { id = @Model.Account.Username }, null) @if (!string.IsNullOrEmpty(Model.Account.TwitterName)) {<div style="text-align: right;" > @Twitter.FollowButton(Model.Account.TwitterName) </div> } </h3><br/>

        <h3>A Game Review On @Model.Game.Name</h3><br/>
    <h3>Posted on @Model.PostedDate</h3><br/>
        <p id="descBackground">@Model.Message</p>
    
    
    @{
        Pro260Website.Models.VideoViewModel viewModel = new Pro260Website.Models.VideoViewModel()
        {
            YoutubeID = Model.YoutubeLink,
            VideoName = Model.FileName
        };

        Html.RenderPartial("VideoDisplay", viewModel);        
    }
         </div>   
</div>

@foreach(Feedback feedback in Model.Feedbacks)
{
    
    <div class="itemTitle @Html.GetColor(Request.Cookies["color"])">@feedback.PostedDate</div>
    <div class="item">
        @Html.ActionLink(@feedback.Account.Username, "ViewAccount", "Account", new { id = @feedback.Account.Username }, null) @if (!string.IsNullOrWhiteSpace(feedback.Account.TwitterName)) {<div style="text-align: right;"> @Twitter.FollowButton(feedback.Account.TwitterName) </div>} <br/>
        <p>@feedback.Message</p><br/>
        
            @if (User.Identity.Name.Equals(feedback.Account.Username) || User.IsInRole("Moderator") || User.IsInRole("Admin"))
            {
                <div style="text-align: right;">
                @Html.ActionLink("Delete Feedback", "DeleteFeedback", new { reviewId = Model.Id, feedbackId = feedback.Id }, new { @class = "actionButtons " + @Html.GetColor(Request.Cookies["color"]) })
                @Html.ActionLink("Edit Feedback", "EditFeedback", new { reviewId = Model.Id, feedbackId = feedback.Id }, new { @class = "actionButtons " + @Html.GetColor(Request.Cookies["color"]) })
                </div>
            }

        
    </div>
}
<br/>

@{
    if(!User.Identity.Name.Equals(""))
    {
             Html.RenderAction("PostFeedback", "Review", new { reviewId = Model.Id });
    }
}
